#!/bin/rc
# extended to IJS driver by K.Okamoto
# duble-sided printing for PSC 2550 printer
#
if (! ~ $DEBUG '') flag x +

# usage: gspipeijs [dev]
# assumes postscript on stdin

switch($#*) {
case 0
	MODEL=`{echo $LPCLASS | sed 's/(.*\+)?gsijs!([^+]*)(\+.*)?/\2/'}
	NUMBER=`{echo $LPCLASS | sed 's/(.*\+)?gsijs!([^+]*)\+(.*)?/\3/'}
case 1
	IJS=$1
case *
	echo 'usage: gspipeijs [dev]' >[1=2]
	exit gspipeijs
}

GSTMPFILE=/tmp/gsp$pid

switch($NUMBER) {
case 2100
	GSOPT=(-q -sDEVICE'='ijs -sIjsServer'='hpijs -sDeviceManufacturer'='HP '-sDeviceModel='"$MODEL^' '^$NUMBER" -r600 -sOutputFile'='^$GSTMPFILE -sPAPERSIZE'='a4 -dIjsUseOutputFD -dSAFER -dNOPAUSE -DBATCH)
case 2500
	GSOPT=(-q -sDEVICE'='ijs -sIjsServer'='hpijs -sDeviceManufacturer'='HP '-sDeviceModel='"$MODEL^' '^$NUMBER" -r600 -sOutputFile'='^$GSTMPFILE -dDuplex'='true -sPAPERSIZE'='a4 -dIjsUseOutputFD -dSAFER -dNOPAUSE -DBATCH)
}

gs $GSOPT  - 

cat $GSTMPFILE
rm $GSTMPFILE

exit
